﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace WebApplication1
{
    public partial class WebFormDisplay : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Data.DataTable myTable = new DataTable("Test");
            System.Data.DataColumn column;
            System.Data.DataRow row;

            //create 3 columns
            column = new DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "STT";
            column.ReadOnly = false;
            // Add the Column to the DataColumnCollection.
            myTable.Columns.Add(column);

            column = new DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Soso";
            column.ReadOnly = false;
            // Add the Column to the DataColumnCollection.
            myTable.Columns.Add(column);

            column = new DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Sothe";
            column.ReadOnly = false;
            // Add the Column to the DataColumnCollection.
            myTable.Columns.Add(column);

            column = new DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Ho";
            column.ReadOnly = false;
            // Add the Column to the DataColumnCollection.
            myTable.Columns.Add(column);

            column = new DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Ten";
            column.ReadOnly = false;
            // Add the Column to the DataColumnCollection.
            myTable.Columns.Add(column);

            column = new DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Tungay";
            column.ReadOnly = false;
            // Add the Column to the DataColumnCollection.
            myTable.Columns.Add(column);

            column = new DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Denngay";
            column.ReadOnly = false;
            // Add the Column to the DataColumnCollection.
            myTable.Columns.Add(column);

            column = new DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Tinh";
            column.ReadOnly = false;
            // Add the Column to the DataColumnCollection.
            myTable.Columns.Add(column);

            column = new DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Mabv";
            column.ReadOnly = false;
            // Add the Column to the DataColumnCollection.
            myTable.Columns.Add(column);

            column = new DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "Lan";
            column.ReadOnly = false;
            // Add the Column to the DataColumnCollection.
            myTable.Columns.Add(column);

            int count = 0;
            while(count < 5)
            {
                row = myTable.NewRow();
                row["STT"] = count;
                row["Soso"] = "000906"+count;
                row["Sothe"] = "MS7333005793"+count;
                row["Ho"] = "Tran Quang ";
                row["Ten"] = "Thanh " + count + 1;
                row["Tungay"] = "01/01/2013";
                row["Denngay"] = "31/12/2014";
                row["Tinh"] = "Hưng Yên";
                row["Mabv"] = "080";
                row["Lan"] = "1";
                myTable.Rows.Add(row);
                count++;
            }

            GridView1.DataSource = myTable;
            GridView1.DataBind();
        }
    }
}